﻿using System;
using System.Collections.Generic;
using System.Configuration.Provider;
using System.Linq;
using System.Text;
using MLMBonus.Engine;

namespace MLMBonus.DataProvider
{
    public abstract class BonusDataProvider : ProviderBase
    {
        /// <summary>
        /// Kicked off when a distributor is promoted to allow promotion information to be perpetrated back to the database.
        /// </summary>
        /// <param name="Distributor">The INode object that was promoted</param>
        /// <param name="OldRank">The original rank of the Distributor.  Doing a simple string serialization for now.</param>
        /// <param name="NewRank">The new rank of the Distributor.  doing a simple string serialization for now.</param>
        public abstract void Promote(INode Distributor, string OldRank, string NewRank);
        /// <summary>
        /// Kicked off when a bonus is paid. Any of the parameters except Distributor and Amount may be null. It is up to the data provider to write the 
        /// payment information back to the database.
        /// </summary>
        /// <param name="Volume">The volume object that triggered the payout.  Null if the payout cannot be tied to a specific
        /// volume.</param>
        /// <param name="Distributor">The Distributor who received the payment.</param>
        /// <param name="Description">A description of the payment given.</param>
        /// <param name="Level">The level at which this payment was made. This value parameter may be null if no level 
        /// was used to kick off the payment.</param>
        /// <param name="Amount">The amount that was earned by a Distributor.</param>
        public abstract void Pay(IVolume Volume, INode Distributor, string Description, int? Level, decimal Amount);
        /// <summary>
        /// Used to retrieve the initial nodes (with volume) from a data provider.
        /// </summary>
        /// <returns>
        /// The list of nodes to be used during a bonus run.
        /// </returns>
        public abstract List<INode> GetNodes();
    }
}
